<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <include file="./Public/Admin/header.html" />
    <style>
        .form-horizontal .control-group {
            margin-bottom: 10px;
        }

        .input-medium {
            width: 330px;
        }

        #keyword {
            width: 323px;
        }
        .span2{margin-bottom: 10px;}
        .span12{overflow: hidden;}
        .span12 .span5{float:left;width: 30%;}
    </style>
</head>
<body>
<div id="main">
    <div class="container-fluid">

        <div class="row-fluid">
            <div class="span12">
                <div class="box">
                    <div class="box-title">
                        <div class="span4">
                            <h3><i class="icon-edit"></i>用户列表</h3>
                        </div>
                    </div>

                    <div class="box-content">

                        <div class="row-fluid">
                            <div class="span10 control-group">
                                <div class="span2" style="width: 100%;">
                                    <a class="btn" href="javascript:location.reload()"><i class="icon-refresh"></i>刷新</a>
                                </div>
                                <div class="btn-group pull-right clearfix " style="float: left;">
                                    <form action="{:U('admin/User/ls')}" method="get" class="form-horizontal" style="margin: 0px;">


                                        <div class="span12" style="margin-left: 0;">
                                            <div class="span5">
                                              <label style="float: left;"> 是否是组长：</label>
                                                <select name="is_leader" class="dropdown-select" id="is_leader">
                                                    <option value="">--不限--</option>
                                                    <option value="0" <?php if($is_leader==0 && !empty($is_leader)){echo "selected='selected'";}?>>不是</option>
                                                    <option value="1" <?php if($is_leader==1){echo "selected='selected'";}?>>是</option>

                                                </select>
                                            </div>
                                            <div class="span5">
                                                <label style="float: left;">是否会员：</label>
                                                <select name="is_vip" class="dropdown-select" id="is_vip">
                                                    <option value="">--不限--</option>
                                                    <option value="0" <?php if($is_vip==0 && !empty($is_vip)){echo "selected='selected'";}?>>不是</option>
                                                    <option value="1" <?php if($is_vip==1){echo "selected='selected'";}?>>是</option>

                                                </select>
                                            </div>
                                            <div class="span5"> <input type="text" id="keyword" name="keyword" value="<?php echo $_GET['keyword'] ?>" class="input-small-z" placeholder="请输入姓名、电话号码" /></div>
                                        </div>

                                        <button class="btn" id="btn_search">查询</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid dataTables_wrapper">
                            <table id="listTable" class="table table-bordered table-hover  dataTable">
                                <thead>
                                <tr>
                                    <th class='with-checkbox'>
                                        <input type="checkbox" class="check_all" /></th>
                                    <th>姓名</th>
                                    <th>电话号码</th>
                                    <th>性别</th>
                                    <th>等级</th>
                                    <th>历史能量值</th>
                                    <th>现有能量值</th>
                                    <th>注册时间</th>
                                    <th>会员</th>
                                    <th>是否冻结</th>
                                    <th>志愿者组长</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="list" item="v">
                                    <?php if(!empty($v['phone'])):?>
                                    <tr>
                                        <td class="with-checkbox">
                                            <input type="checkbox" name="check" value="{$v.id}">
                                        </td>
                                        <td style="text-align:left;"><?php echo $v['true_name']?></td>
                                        <td style="text-align:left;"><?php echo $v['phone']?></td>
                                        <td style="text-align:left;"><?php if($v['sex']==1):?>
                                            男
                                            <?php else:?>
                                            女
                                            <?php endif;?></td>
                                        <td style="text-align:left;"><?php echo $v['level']?></td>
                                        <td style="text-align:left;"><?php echo $v['history_energy']?></td>
                                        <td style="text-align:left;"><?php echo $v['now_energy']?></td>
                                        <td style="text-align:left;"><?php if($v['reg_time']>0) echo date('Y-m-d H:i',$v['reg_time']);?></td>
                                        <td style="text-align:left;">
                                            <?php if($v['is_vip']==1):?>
                                            <span style="color: red;"> 是</span>
                                            <?php else:?>
                                            不是
                                            <?php endif;?></td>
                                        <td style="text-align:left;">
                                            <?php if($v['is_freeze']==1):?>
                                            <span style="color: red;"> 是</span>
                                            <a href="{:U('Admin/User/freeze',array('id'=>$v['id']))}" class="btn" rel="tooltip" title="解冻"><i class="icon-edit">解冻</i></a>
                                            <?php else:?>
                                            否
                                            <?php endif;?></td>
                                        <td style="text-align:left;">
                                            <?php if($v['is_leader']==1):?>
                                            <span style="color: red;"> 是</span>
                                            <?php else:?>
                                            <a href="{:U('Admin/Permission/addusers')}?action=add&user_id={$v.id}&true_name={$v.true_name}" class="btn" rel="tooltip" title="设置为组长">设置为组长</a>
                                            <?php endif;?></td>
                                        <td class='hidden-480'>
                                            <a href="{:U('Admin/User/detail',array('id'=>$v['id']))}" class="btn" rel="tooltip" title="查看详情"><i class="icon-edit">查看详情</i></a>

                                        </td>
                                    </tr>
                                    <?php endif;?>
                                </foreach>
                                <if condition="($count eq 0) ">
                                    <tr><td align="center" colspan="11">暂无记录</td></tr>
                                </if>
                                </tbody>
                            </table>
                            <div class="row-fluid">
                                <div class="span4">
                                    <div class="dataTables_info">
                                        <if condition="($count gt 0) ">
                                            共{$count}条记录，当前第{$nowPage}/{$totalPages}页
                                        </if>
                                    </div>
                                </div>
                                <div class="span8">
                                    {$page}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<script>
    $(function(){

        //删除内容
        $("a[attr^='deltext_info_']").click(function(){
            var tmp = $(this).attr('attr').split('_');
            var ids = new Array();
            ids[0]=tmp[2];
            delText(ids);
        });
        $("[attr='BatchDelInfo']").click(function(){
            var check = $("input:checked");
            if(check.length<1){
                G.ui.tips.err('请选择删除项');
                return false;
            }
            var ids = new Array();
            check.each(function(i){
                ids[i] = $(this).val();
            });
            delText(ids);
        });
    });
    //删除内容
    function delText(ids){
        G.ui.tips.confirm_flag('您确定要删除吗?',function(){
            // alert(ids);
            $.post("{:U('Admin/User/user_del')}", {ids:ids},function(data){
                if (data.errno ==0)
                {
                    location.reload();
                } else {
                    G.ui.tips.err(data.error);
                }
            },'json');
        });
    }
</script>
</body>
</html>